import random

from bank.Address import Address


class User:
    def __init__(self, account, name, password, address, money,bank):
        self.account = account
        self.name = name
        self.password = password
        self.address = address
        self.money = money
        self.bank = bank


    @staticmethod
    def add_user():
        # 系统随机产生8位数字
        account = random.randint(10000000, 99999999)
        user_name = input("请输入用户姓名: ")
        user_password = input("请输入用户密码: ")
        country = input("请输入国家： ")
        province = input("请输入省份： ")
        street = input("请输入街道： ")
        zip_code = input("请输入门牌号： ")
        user_address = Address(country, province, street, zip_code).__str__()
        user_money = input("请输入用户余额: ")
        user_bank = input("请输入用户开户银行: ")
        return User(account,user_name, user_password, user_address, float(user_money),user_bank)


    def __str__(self):
        return "账号：%s\n姓名：%s\n密码：%s\n地址：%s\n余额：%f.2\n银行：%s" % (self.account, self.name, self.password, self.address, self.money,self.bank)